import { BasicColumn, FormSchema } from '@/components/Table';

export const tableColumns: BasicColumn[] = [
  { title: '序号', dataIndex: 'sortNo' },
  { title: 'id', dataIndex: 'id' },
  { title: '名称', dataIndex: 'name' },
  { title: '售价', dataIndex: 'unitSellingPrice' },
  {
    title: '赠送金额',
    dataIndex: 'specialInfo',
    customRender: ({ text }) => {
      return text?.['giftAmount'];
    },
  },
  { title: '状态', dataIndex: 'status', slots: { customRender: 'status' } },
  { title: '创建时间', dataIndex: 'createdTime' },
];

export const tableFormSchema: FormSchema[] = [];

export const modalFormSchema: FormSchema[] = [
  {
    field: 'id',
    label: '编号',
    ifShow: false,
    component: 'Input',
  },
  {
    field: 'stdSpecId',
    label: '标准规格id',
    ifShow: false,
    component: 'Input',
  },
  {
    required: true,
    field: 'name',
    label: '名称',
    component: 'Input',
  },
  {
    required: true,
    field: 'unitSellingPrice',
    label: '售价',
    component: 'InputNumber',
  },
  {
    required: true,
    field: 'giftAmount',
    label: '贈送金额',
    component: 'InputNumber',
  },
  // {
  //   required: false,
  //   field: 'giftStdSpecId',
  //   label: '贈送金额',
  //   component: 'ApiSelect',
  //   componentProps: {
  //     allowClear: true,
  //     labelField: 'name',
  //     resultField: 'items',
  //     valueField: 'stdSpecId',
  //     api: SpuApi.getSpuRechargePage,
  //   },
  // },
  {
    required: true,
    field: 'sortNo',
    label: '序号',
    component: 'InputNumber',
  },
];
